_onMenuButtonRelease: function (actor, event) {
let clone = this._findWindowCloneForActor(event.get_source());
if (clone) {
+ this.didActivateWindow = true;
Main.overview.activateWindow(clone.metaWindow, event.get_time());
}
},
_onWindowActivate: function (actor, child) {
let metaWindow = child._window;
+ this.didActivateWindow = true;
Main.overview.activateWindow(metaWindow, Clutter.get_current_event_time());
this.emit('popup', false);
this.actor.hide();
this._menu.connect('popup', Lang.bind(this, function (menu, isPoppedUp) {
let id;
+ // If we successfully picked a window, don't reset the workspace
+ // state, since picking a window already did that.
+ if (!isPoppedUp && menu.didActivateWindow)
+ return;
if (isPoppedUp)
id = this.appInfo.get_id();
else
return this._lookupIndex(metaWindow) >= 0;
},
- setShowOnlyWindows: function(showOnlyWindows) {
+ setShowOnlyWindows: function(showOnlyWindows, reposition) {
this._showOnlyWindows = showOnlyWindows;
- this.positionWindows(false);
+ this._resetCloneVisibility();
+ if (reposition)
+ this.positionWindows(false);
},
/**
this._desktop.actor.height + 2 * FRAME_SIZE / this.actor.scale_y);
},
- // Reposition all windows in their zoomed-to-Overview position. if workspaceZooming
- // is true, then the workspace is moving at the same time and we need to take
- // that into account
+ _resetCloneVisibility: function () {
+ for (let i = 1; i < this._windows.length; i++) {
+ let clone = this._windows[i];
+ let icon = this._windowIcons[i];
+
+ if (this._showOnlyWindows != null && !(clone.metaWindow in this._showOnlyWindows)) {
+ clone.setVisibleWithChrome(false);
+ icon.hide();
+ } else {
+ clone.setVisibleWithChrome(true);
+ }
+ }
+ },
+
+ /**
+ * positionWindows:
+ * @workspaceZooming: If true, then the workspace is moving at the same time and we need to take that into account.
+ */
positionWindows : function(workspaceZooming) {
let totalVisible = 0;
let clone = this._windows[i];
let icon = this._windowIcons[i];
- if (this._showOnlyWindows != null && !(clone.metaWindow in this._showOnlyWindows)) {
- clone.setVisibleWithChrome(false);
- icon.hide();
+ if (this._showOnlyWindows != null && !(clone.metaWindow in this._showOnlyWindows))
continue;
- } else {
- clone.setVisibleWithChrome(true);
- }
clone.stackAbove = previousWindow.actor;
previousWindow = clone;
this._x = x;
this._y = y;
+ this._windowSelectionAppId = null;
+
this._workspaces = [];
this._highlightWindow = null;
}
},
+ _clearApplicationWindowSelection: function(reposition) {
+ if (this._windowSelectionAppId == null)
+ return;
+ this._windowSelectionAppId = null;
+
+ for (let i = 0; i < this._workspaces.length; i++) {
+ this._workspaces[i].setLightboxMode(false);
+ this._workspaces[i].setShowOnlyWindows(null, reposition);
+ }
+ },
+
/**
* setApplicationWindowSelection:
* @appid: Application identifier string
* window with setHighlightWindow().
*/
setApplicationWindowSelection: function (appId) {
+ if (appId == null) {
+ this._clearApplicationWindowSelection(true);
+ return;
+ }
+
+ if (appId == this._windowSelectionAppId)
+ return;
+
+ this._windowSelectionAppId = appId;
+
let appSys = Shell.AppMonitor.get_default();
- let showOnlyWindows;
- if (appId) {
- let windows = appSys.get_windows_for_app(appId);
- showOnlyWindows = {};
- for (let i = 0; i < windows.length; i++) {
- showOnlyWindows[windows[i]] = 1;
- }
- } else {
- showOnlyWindows = null;
+ let showOnlyWindows = {};
+ let windows = appSys.get_windows_for_app(appId);
+ for (let i = 0; i < windows.length; i++) {
+ showOnlyWindows[windows[i]] = 1;
}
+
for (let i = 0; i < this._workspaces.length; i++) {
- this._workspaces[i].setLightboxMode(showOnlyWindows != null);
- this._workspaces[i].setShowOnlyWindows(showOnlyWindows);
+ this._workspaces[i].setLightboxMode(true);
+ this._workspaces[i].setShowOnlyWindows(showOnlyWindows, true);
}
},
- // Should only be called from active Overview context
- activateWindowFromOverview: function (metaWindow, time) {
+ _activateWindowInternal: function (metaWindow, time) {
let activeWorkspaceNum = global.screen.get_active_workspace_index();
let windowWorkspaceNum = metaWindow.get_workspace().index();
}
},
+ /**
+ * activateWindowFromOverview:
+ * @metaWindow: A #MetaWindow
+ * @time: Integer even timestamp
+ *
+ * This function exits the overview, switching to the given @metaWindow.
+ * If an application filter is in effect, it will be cleared.
+ */
+ activateWindowFromOverview: function (metaWindow, time) {
+ if (this._windowSelectionAppId != null) {
+ this._clearApplicationWindowSelection(false);
+ }
+ this._activateWindowInternal(metaWindow, time);
+ Main.overview.hide();
+ },
+
hide : function() {
let activeWorkspaceIndex = global.screen.get_active_workspace_index();
let activeWorkspace = this._workspaces[activeWorkspaceIndex];